<?php
namespace app\index\model;

use think\Model;

class OrderItem extends Model
{
    protected $table = 'order_items';

    // 定义与订单模型的关联
    public function order()
    {
        return $this->belongsTo('Order', 'order_id');
    }

    // 定义与商品模型的关联
    public function product()
    {
        return $this->hasOne('Product', 'pId', 'product_id');
    }
}